<template>
  <div class="slide">
    <el-carousel height="240px">
      <el-carousel-item v-for="item in list" :key="item.img">
        <img :src="item.img" @click="advertise(item.url)"/>
      </el-carousel-item>
    </el-carousel>
  </div>
</template>
<script>
import { simpleSearch } from "@/api/esproduct";
export default {
  props: {
    adList: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  data() {
    return {
      list: []
    };
  },
  watch: {
    adList() {
      this.list = this.adList.map(item => {
        return {
          url: item.url,
          img: item.pic
        };
      });
    }
  },
  methods: {
    advertise(url) {
      this.$router.push({
        path: "/products",
        query: {
          keyword: url
        }
      });
    }
  }
};
</script>
